home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Assembly / Mac68k / MANUAL / MAN6.DOC < prev    next >
Encoding:
Text File  |  1985-08-11  |  12.0 KB  |  443 lines  |  [TEXT/Anon]

  1.  
  2.                                                                 MAC.68K
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                                 ENDD
  10.                                 ENDD
  11.                                 ENDD
  12.  
  13.  
  14.  
  15.  
  16.   PURPOSE         To terminate a DUP block.
  17.  
  18.  
  19.  
  20.  
  21.   FORMAT               ENDD
  22.  
  23.  
  24.              dupname   ENDD
  25.  
  26.  
  27.  
  28.  
  29.   DESCRIPTION     A unnamed ENDD will always terminate the current
  30.  
  31.  
  32.                DUP or ECHO block even if the block has a dupname. A
  33.  
  34.  
  35.                named ENDD terminates the current block if its dupname
  36.  
  37.  
  38.                matches the block name. A named ENDD will be ignored
  39.  
  40.  
  41.                if its name does not match the active dupname.
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.                                 ENDM
  52.                                 ENDM
  53.                                 ENDM
  54.  
  55.  
  56.  
  57.  
  58.   PURPOSE         To end a macro definition.
  59.  
  60.  
  61.  
  62.  
  63.   FORMAT                ENDM
  64.  
  65.  
  66.              macroname  ENDM
  67.  
  68.  
  69.  
  70.  
  71.   DESCRIPTION     ENDM terminates a macro definition. Accidently
  72.  
  73.  
  74.                ommitting an ENDM results in the apparent loss of code
  75.  
  76.  
  77.                since the following lines are placed into the macro
  78.  
  79.  
  80.                definition and are not assembled.
  81.  
  82.  
  83.  
  84.                    A named ENDM does not terminate a macro defintion
  85.  
  86.  
  87.                unless the macroname matches the MACRO or MACROL being
  88.  
  89.  
  90.                defined. This allows macro definitions to be placed
  91.  
  92.  
  93.                inside a macro definition. A macro nested in this
  94.  
  95.  
  96.                manner will not be defined until the outer level macro
  97.  
  98.  
  99.                is called.
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. MAC.68K                                  -30-
  117.  
  118.  
  119.  
  120. MAC.68K
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                                ENTRY
  127.                                ENTRY
  128.                                ENTRY
  129.  
  130.  
  131.  
  132.  
  133.  
  134.   PURPOSE         To specify relative symbolic entry points for a module
  135.  
  136.  
  137.                assembly.
  138.  
  139.  
  140.  
  141.  
  142.  
  143.   FORMAT               ENTRY  symbol,symbol,...symbol
  144.  
  145.  
  146.  
  147.  
  148.  
  149.   DESCRIPTION     ENTRY is used with MODULE to provide a list of
  150.  
  151.  
  152.                symbol names and offset values that are placed in the
  153.  
  154.  
  155.                module object file. Any symbol name defined in the
  156.  
  157.  
  158.                module may be used. Since modules are assigned an
  159.  
  160.  
  161.                origin address of $0, the symbol values represent a
  162.  
  163.  
  164.                relative offset from the start ($0) of the module.
  165.  
  166.  
  167.  
  168.                    When the object module is later used in another
  169.  
  170.  
  171.                assembly, these $0 relative values will be biased by
  172.  
  173.  
  174.                the current location address in the calling assembly,
  175.  
  176.  
  177.                and the symbol with its new value will be entered into
  178.  
  179.  
  180.                the symbol table.
  181.  
  182.  
  183.  
  184.  
  185.  
  186.   EXAMPLE              ENTRY   READCH,WRITECH
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.                               -31-                              MAC.68K
  219.  
  220.  
  221.  
  222.                                                                 MAC.68K
  223.  
  224.  
  225.  
  226.  
  227.  
  228.                              EQU  or  =
  229.                              EQU  or  =
  230.                              EQU  or  =
  231.  
  232.  
  233.  
  234.  
  235.  
  236.   PURPOSE         To define a symbol.
  237.  
  238.  
  239.  
  240.  
  241.  
  242.   FORMAT     symbol    EQU    expression
  243.  
  244.  
  245.              symbol    =      expression
  246.  
  247.  
  248.  
  249.  
  250.  
  251.   DESCRIPTION     EQU assigns a permanent value to the symbol name in
  252.  
  253.  
  254.                the location field. Any symbols used in the expression
  255.  
  256.  
  257.                must have been previously defined.  If an error is
  258.  
  259.  
  260.                detected the symbol remains undefined, or retains its
  261.  
  262.  
  263.                current value if a redefinition is attempted.
  264.  
  265.  
  266.  
  267.                    EQU may not be used on a symbol previously
  268.  
  269.  
  270.                established as redefinable with a SET, MAX, MIN, or
  271.  
  272.  
  273.                STRCNT. Also any symbol previously established as
  274.  
  275.  
  276.                permanent may not be redefined with EQU, SET, MAX,
  277.  
  278.  
  279.                MIN, or STRCNT.
  280.  
  281.  
  282.  
  283.  
  284.  
  285.   EXAMPLES   RESET     EQU     0
  286.  
  287.  
  288.              SAMPLE2   EQU     SAMPLE1+1
  289.  
  290.  
  291.              reset     =       0
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322. MAC.68K                                  -32-
  323.  
  324.  
  325.  
  326. MAC.68K
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                                ERRxx
  333.                                ERRxx
  334.                                ERRxx
  335.  
  336.  
  337.  
  338.  
  339.   PURPOSE         To force a source line fatal error flag type P.
  340.  
  341.  
  342.  
  343.  
  344.   FORMAT               ERR
  345.  
  346.  
  347.                        ERRxx     expression
  348.  
  349.  
  350.  
  351.                        xx =   EQ  NE  GE  GT  LE  LT
  352.  
  353.  
  354.  
  355.  
  356.   DESCRIPTION     ERRxx can be used to detect and call attention to
  357.  
  358.  
  359.                program errors at assembly time. For example, a macro
  360.  
  361.  
  362.                expansion might do range checks on parameters and
  363.  
  364.  
  365.                force an assembly error if the macro was called with
  366.  
  367.  
  368.                an invalid parameter. ERRxx checks are done during
  369.  
  370.  
  371.                pass 2 and may contain forward symbol references.
  372.  
  373.  
  374.  
  375.                    ERR unconditionally forces a P type source line
  376.  
  377.  
  378.                error.
  379.  
  380.  
  381.  
  382.                    ERRxx compares the value of the expression in the
  383.  
  384.  
  385.                operation field and produces an error if condition xx
  386.  
  387.  
  388.                is true. For example, ERREQ produces an error when the
  389.  
  390.  
  391.                expression value is zero.
  392.  
  393.  
  394.  
  395.  
  396.   EXAMPLES             ERREQ   PAGESIZE
  397.  
  398.  
  399.                        ERRGT   P1-5
  400.  
  401.  
  402.  
  403.                        IFS     EQ,$P1$$,1     CHECK FOR A NULL PARAMETER
  404.  
  405.  
  406.                        ERR                    P1 IS A REQUIRED PARAMETER
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.                                 EVEN
  416.                                 EVEN
  417.                                 EVEN
  418.  
  419.  
  420.  
  421.  
  422.   PURPOSE         To force the location counter to an even boundary.
  423.  
  424.  
  425.  
  426.  
  427.   FORMAT               EVEN
  428.  
  429.  
  430.  
  431.  
  432.   DESCRIPTION     If the current location counter is at an odd
  433.  
  434.  
  435.                address, EVEN adds one to its value to set it to an
  436.  
  437.  
  438.                even address boundary.  Note that all CPU
  439.  
  440.  
  441.                instructions, word and long word data operations, and
  442.  
  443.  
  444.                section pseudo ops automatically adjust to even word
  445.  
  446.  
  447.                boundaries.
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.                               -33-                              MAC.68K
  455.  
  456.  
  457.  
  458.                                                                 MAC.68K
  459.  
  460.  
  461.  
  462.  
  463.  
  464.                                GLOBL
  465.                                GLOBL
  466.                                GLOBL
  467.  
  468.  
  469.  
  470.  
  471.  
  472.   PURPOSE         To declare external symbol names.
  473.  
  474.  
  475.  
  476.  
  477.  
  478.   FORMAT               GLOBL  symbol
  479.  
  480.  
  481.                        GLOBL  symbol,symbol,...
  482.  
  483.  
  484.  
  485.  
  486.  
  487.   DESCRIPTION     GLOBL declares symbols to be external. If the
  488.  
  489.  
  490.                symbol is defined in the current assembly, the symbol
  491.  
  492.  
  493.                is written to the .O file as a defined external symbol
  494.  
  495.  
  496.                and becomes available for use in other routines at
  497.  
  498.  
  499.                LO68 link time. If the symbol is undefined in the
  500.  
  501.  
  502.                current assembly, it is written to the .O file as an
  503.  
  504.  
  505.                undefined external symbol and LO68 searches the other
  506.  
  507.  
  508.                load modules to locate the address of the symbol.
  509.  
  510.  
  511.  
  512.                    The -U invocation option sets all undefined
  513.  
  514.  
  515.                symbols as external references. This is useful for C
  516.  
  517.  
  518.                programs which make many references to library
  519.  
  520.  
  521.                routines, but it can mask legitimate undefined symbol
  522.  
  523.  
  524.                names when used with assembler source files. One can
  525.  
  526.  
  527.                use explicit GLOBL statements and avoid the -U
  528.  
  529.  
  530.                option.
  531.  
  532.  
  533.  
  534.  
  535.  
  536.   EXAMPLE              GLOBL   DUMPMEM,DUMPREG
  537.  
  538.  
  539.                        GLOBL   CINCO
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566. MAC.68K                                  -34-
  567.  
  568.  
  569.  
  570. MAC.68K
  571.  
  572.  
  573.  
  574.  
  575.  
  576.                                 HERE
  577.                                 HERE
  578.                                 HERE
  579.  
  580.  
  581.  
  582.  
  583.  
  584.   PURPOSE         To assemble a block of code saved by previous
  585.  
  586.  
  587.                DEFER(s).
  588.  
  589.  
  590.  
  591.  
  592.  
  593.   FORMAT               HERE
  594.  
  595.  
  596.              defname   HERE
  597.  
  598.  
  599.  
  600.  
  601.  
  602.   DESCRIPTION     HERE inserts all source lines saved by prior
  603.  
  604.  
  605.                similiarly named DEFERs. A HERE with no source lines
  606.  
  607.  
  608.                in its DEFER buffer has no effect on the assembly.
  609.  
  610.  
  611.  
  612.  
  613.  
  614.   EXAMPLE
  615.  
  616.  
  617.  
  618.      TABLE   MACRO   P1,P2,P3                CHAR   TABLE   'A',1,PROCA
  619.  
  620.  
  621.              DC.B    P1                             TABLE   'B',2,PROCB
  622.  
  623.  
  624.      T2      DEFER                                  TABLE   'C',3,PROCC
  625.  
  626.  
  627.              DC      P2                      VALUE  DS      0
  628.  
  629.  
  630.              DEFER                           T2     HERE
  631.  
  632.  
  633.      T3      DEFER                           PADDR  DS.L    0
  634.  
  635.  
  636.              DC.L    P3                      T3     HERE
  637.  
  638.  
  639.              DEFER
  640.  
  641.  
  642.              ENDM
  643.  
  644.  
  645.                                                     generates
  646.  
  647.  
  648.  
  649.                                              CHAR   DC.B    'A'
  650.  
  651.  
  652.                                                     DC.B    'B'
  653.  
  654.  
  655.                                                     DC.B    'C'
  656.  
  657.  
  658.                                              VALUE  DS      0
  659.  
  660.  
  661.                                                     DC      1
  662.  
  663.  
  664.                                                     DC      2
  665.  
  666.  
  667.                                                     DC      3
  668.  
  669.  
  670.                                              PADDR  DS.L    0
  671.  
  672.  
  673.                                                     DC.L    PROCA
  674.  
  675.  
  676.                                                     DC.L    PROCB
  677.  
  678.  
  679.                                                     DC.L    PROCC
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.                               -35-                              MAC.68K
  697.  
  698.  
  699.  
  700.                                                                 MAC.68K
  701.  
  702.  
  703.  
  704.  
  705.  
  706.                                IDENT
  707.                                IDENT
  708.                                IDENT
  709.  
  710.  
  711.  
  712.  
  713.  
  714.   PURPOSE         To identify start of program text, program name, and
  715.  
  716.  
  717.                program absolute origin.
  718.  
  719.  
  720.  
  721.  
  722.  
  723.   FORMAT               IDENT
  724.  
  725.  
  726.                        IDENT  name
  727.  
  728.  
  729.                        IDENT  name,origin
  730.  
  731.  
  732.                        IDENT  name,origin,data,bss
  733.  
  734.  
  735.  
  736.  
  737.  
  738.   DESCRIPTION     An IDENT is an optional first card in a MAC.68K
  739.  
  740.  
  741.                input source file. If the name field is present, it
  742.  
  743.  
  744.                identifies the program name and is used as the base
  745.  
  746.  
  747.                file name for the object file. Else the source file
  748.  
  749.  
  750.                name is used as the base file name for the object
  751.  
  752.  
  753.                file.
  754.  
  755.  
  756.  
  757.                    In the Macintosh environment the default (and for
  758.  
  759.  
  760.                now the only practical) load address is 0. There is no
  761.  
  762.  
  763.                fixed load address for the Mac, and every assembly
  764.  
  765.  
  766.                language program should be programmed using relative
  767.  
  768.  
  769.                addressing. The only absolute references should be to
  770.  
  771.  
  772.                the operating systems fixed location variables and
  773.  
  774.  
  775.                constants in low memory ($16A - $B00). The following
  776.  
  777.  
  778.                paragraphs describe features available for CPM/68K
  779.  
  780.  
  781.                usage.
  782.  
  783.  
  784.  
  785.                    MAC.68K uses its own load address as the default
  786.  
  787.  
  788.                absolute load origin address for a .68K object file.
  789.  
  790.  
  791.                For an absolute load address higher than $500, the
  792.  
  793.  
  794.                optional origin field may be used to specify the
  795.  
  796.  
  797.                desired address.  Once selected, no code may be
  798.  
  799.  
  800.                origined lower than the load address.
  801.  
  802.  
  803.  
  804.                    When generating .68K object files, MAC.68K by
  805.  
  806.  
  807.                default assigns the data and bss segments to be
  808.  
  809.  
  810.                contiguous with the program segment. To specifically
  811.  
  812.  
  813.                assign origins to these segments, the data and bss
  814.  
  815.  
  816.                fields may be used on the IDENT card.  These two
  817.  
  818.  
  819.                fields may contain forward symbol references.
  820.  
  821.  
  822.  
  823.  
  824.  
  825.   EXAMPLES             IDENT   CONVERT
  826.  
  827.  
  828.                        IDENT   CONVERT,$4000
  829.  
  830.  
  831.                        IDENT   TEST,$1000,$4000,$8000
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840. MAC.68K                                  -36-
  841.  
  842.  
  843. $4000
  844.  
  845.  
  846.                        IDENT   TEST,$1000,$4000,$8000
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855. MAC.68K